Mainly applied in the field of servers, memory hot-swap technology improves availability and maintainability of a server. According to the memory hot-swap technology, a server includes a hardware layer, a Basic Input Output System (BIOS) layer, an operating system Operating System (OS) (which may further includes a Virtual Machine Monitor (VMM)) layer. The VMM layer includes at least two memory modules. FIG. 1 shows relationships between the layers. In the logical structure that is shown, the hardware layer provides physical resources that are actually available; the BIOS layer configures these physical resources, reports available resources, and provides an operation interface; the OS may directly use the resources reported by the BIOS, or the VMM virtualizes the resources and then allocates the virtualized resources to the OS for use, that is, the OS is an ultimate user of these resources. In a memory hot-swap technology, the hardware layer provides substantive memory modules and access channels; the BIOS layer initializes a memory, allocates addresses, and reports available addresses to the OS or the VMM; and finally the OS runs a program in or stores data into the memory. Memory hot-swap includes two processes: memory hot-add and memory hot-remove.
In the prior art, when memory hot-remove is performed, the OS first needs to migrate data at memory addresses that is to be hot-removed to other memory addresses. However, each time before the OS migrates a memory page, the OS needs to gain control of the page and suspends access of another program. Therefore, if to-be-migrated user data is frequently accessed by another program, it takes the OS some time to gain control of the memory page each time. Subsequently, it takes a long time to complete data migration for an entire memory module.
In summary, memory data migration depends closely on the OS, and data distribution and a memory data migration capability that are of the OS may affect success or failure of memory data migration. Therefore, how to implement convenient data migration of a memory module becomes a problem to be urgently addressed currently.